import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'


Vue.prototype.$http = axios
//配置根路径
axios.defaults.baseURL = "http://127.0.0.1:8081"

axios.interceptors.request.use(config =>{
  //config中就可以设置request响应头
  config.headers.Authorization = window.sessionStorage.getItem('token');
  return config
})



//拦截response
axios.interceptors.response.use(function (response) {
  // Do something with response data
  //console.log(response);
  const res = response.data
  
  return response;
}, function (error) {
  // Do something with response error
  return Promise.reject(error);
});

//组织生产消息
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
